/**   
 * 项目名：phms3
 * 日期：    2019-11-23 18:57:25  
 * Copyright (c) 2015- HTSC-版权所有     
 */

package com.joysuch.wwyt.mh.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_mh_major_hazard_chem_product_rel")
@SQLDelete(sql = "update wwyt_mh_major_hazard_chem_product_rel set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_mh_major_hazard_chem_product_rel set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
public class MhMajorHazardChemProductRel implements java.io.Serializable {

    // columns START
    //
    private Long id;
    //危险源Id
    private Long majorHazardId;
    //危化品性质
    private String chemProductFeature;
    //物理状态
    private String substanceStatus;
    //操作压力
    private String operationPressure;
    //操作温度
    private String operationTemperature;
    //设计存量
    private Double designStock;
    //存量
    private Double stock;
    //临界量
    private Double criticalStock;
    //校正系数
    private Double fixRate;
    //
    private Long createBy;
    //
    private java.time.LocalDateTime createTime;
    //
    private Long updateBy;
    //
    private java.time.LocalDateTime updateTime;
    //
    private String deleteFlag;
    // columns END
    //生产用途
    private String usage;
    private Long tenentId;
    private String orgCode;

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    @Column(name = "MAJOR_HAZARD_ID")
    public Long getMajorHazardId() {
        return this.majorHazardId;
    }

    public void setMajorHazardId(Long value) {
        this.majorHazardId = value;
    }

    @Column(name = "USAGE_CONTENT", length = 255)
    public String getUsage() {
        return usage;
    }

    public void setUsage(String usage) {
        this.usage = usage;
    }

    @Column(name = "CHEM_PRODUCT_FEATURE", length = 64)
    public String getChemProductFeature() {
        return this.chemProductFeature;
    }

    public void setChemProductFeature(String value) {
        this.chemProductFeature = value;
    }

    @Column(name = "SUBSTANCE_STATUS", length = 10)
    public String getSubstanceStatus() {
        return this.substanceStatus;
    }

    public void setSubstanceStatus(String value) {
        this.substanceStatus = value;
    }

    @Column(name = "OPERATION_PRESSURE")
    public String getOperationPressure() {
        return this.operationPressure;
    }

    public void setOperationPressure(String value) {
        this.operationPressure = value;
    }

    @Column(name = "OPERATION_TEMPERATURE")
    public String getOperationTemperature() {
        return this.operationTemperature;
    }

    public void setOperationTemperature(String value) {
        this.operationTemperature = value;
    }

    @Column(name = "DESIGN_STOCK")
    public Double getDesignStock() {
        return this.designStock;
    }

    public void setDesignStock(Double value) {
        this.designStock = value;
    }

    @Column(name = "STOCK")
    public Double getStock() {
        return this.stock;
    }

    public void setStock(Double value) {
        this.stock = value;
    }

    @Column(name = "CRITICAL_STOCK")
    public Double getCriticalStock() {
        return this.criticalStock;
    }

    public void setCriticalStock(Double value) {
        this.criticalStock = value;
    }

    @Column(name = "FIX_RATE")
    public Double getFixRate() {
        return this.fixRate;
    }

    public void setFixRate(Double value) {
        this.fixRate = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public java.time.LocalDateTime getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(java.time.LocalDateTime value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public java.time.LocalDateTime getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(java.time.LocalDateTime value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return tenentId;
    }

    public void setTenentId(Long tenentId) {
        this.tenentId = tenentId;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    private MhMajorHazardChemProduct mhMajorHazardChemProduct;

    @OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
    @JoinColumn(name = "CHEM_PRODUCT_ID")
    public MhMajorHazardChemProduct getMhMajorHazardChemProduct() {
        return this.mhMajorHazardChemProduct;
    }

    public void setMhMajorHazardChemProduct(MhMajorHazardChemProduct mhMajorHazardChemProduct) {
        this.mhMajorHazardChemProduct = mhMajorHazardChemProduct;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("majorHazardId", getMajorHazardId()).append("chemProductFeature", getChemProductFeature())
                .append("substanceStatus", getSubstanceStatus()).append("operationPressure", getOperationPressure())
                .append("operationTemperature", getOperationTemperature()).append("designStock", getDesignStock())
                .append("stock", getStock()).append("criticalStock", getCriticalStock()).append("fixRate", getFixRate())
                .append("createBy", getCreateBy()).append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime())
                .append("deleteFlag", getDeleteFlag()).toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof MhMajorHazardChemProductRel == false)
            return false;
        if (this == obj)
            return true;
        MhMajorHazardChemProductRel other = (MhMajorHazardChemProductRel) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }

}
